package com.wunong.smart.commission.domain.state;

import com.wunong.smart.commission.application.request.BaseCommissionRequest;
import com.wunong.smart.commission.application.request.support.CancelCommissionRequest;
import com.wunong.smart.commission.application.request.support.CreateCommissionRequest;
import com.wunong.smart.commission.application.request.support.FinishCommissionRequest;
import com.wunong.smart.commission.client.enums.CommissionOperationEnum;
import com.wunong.smart.commission.client.enums.CommissionStatusEnum;
import com.wunong.smart.commission.domain.model.CommissionDomain;
import com.wunong.smart.domain.platform.exception.IllegalOperateException;

/**
 * 代办状态服务
 *
 * @author create by zealot.zt
 */
public interface CommissionState {

    /**
     * 创建代办
     *
     * @param request
     * @param domain
     * @return
     */
    default CommissionDomain create(CreateCommissionRequest request, CommissionDomain domain) {
        throw new IllegalOperateException("不支持创建代办，请刷新页面重试");
    }

    /**
     * 修改代办
     *
     * @param request
     * @param domain
     * @return
     */
    default CommissionDomain modify(CreateCommissionRequest request, CommissionDomain domain) {
        throw new IllegalOperateException("不支持新增代办，请刷新页面重试");
    }

    /**
     * 取消代办
     *
     * @param request
     * @param domain
     * @return
     */
    default CommissionDomain cancel(CancelCommissionRequest request, CommissionDomain domain) {
        throw new IllegalOperateException("不支持取消代办，请刷新页面重试");
    }

    /**
     * 结束代办
     *
     * @param request
     * @param domain
     * @return
     */
    default CommissionDomain finish(FinishCommissionRequest request, CommissionDomain domain) {
        throw new IllegalOperateException("不支持结束代办，请刷新页面重试");
    }

    /**
     * 执行对应的操作
     *
     * @param operationEnum
     * @param request
     * @param domain
     * @return
     */
    Object operate(CommissionOperationEnum operationEnum, BaseCommissionRequest request, CommissionDomain domain);

    /**
     * 获取状态
     *
     * @return
     */
    CommissionStatusEnum getStatusEnum();

}
